package com.wu.error;

/**
 * @author: 吴磊
 * @program: blog
 * @create: 2021-04-19 21:31
 */

/**
 * 枚举类的异常类，主要是用来统一错误码
 *
 * @author 29216
 */
public enum EnumBusinessError implements CommonError {
    //通用的错误类型 10001
    PARAMETER_INVALID_ERROR(10001, "参数不合法"),
    UNKNOWN_ERROR(10002, "未知错误，请联系管理员：QQ：2921625957"),

    //20000 开头为用户信息相关错误定义
    USER_NOT_EXIST(20001, "用户不存在"),
    PHONE_NUMBER_IS_EXIST(20002, "手机号已注册"),
    USER_LOGIN_FAIL(20003, "用户手机号或密码不正确"),
    USER_NOT_LOGIN(20004, "用户还未登录");


    private int errorCode;

    private String errorMsg;

    EnumBusinessError(int errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }


    @Override
    public int getErrorCode() {
        return this.errorCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errorMsg;
    }

    @Override
    public CommonError setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
        return this;
    }
}

